#include<bits/stdc++.h>
using namespace std;
int n,a[100005],r,l,mid1,max2,min2,lose[100005],win[100005];
int ans,m,k,pin,x,b,c;
int qread(){
    int x=0;char c=getchar();int f=1;
    for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
    for(;isdigit(c);c=getchar())x=(x<<3)+(x<<1)+(c^48);
    return x*f;
}
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    n=qread();
    for(int i=1;i<=n;i++) a[i]=qread();
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            if(a[i]>a[j]){
                m=a[i];
                a[i]=a[j];
                a[j]=m;
            }
        }
    }
    if(n%2==0){
        int cnt=0;
        k=n/2+1,b=n/2,c=n/2+2;
        while(a[k]=a[b]){
            cnt++,b--;
        }
        while(a[k]=a[c]){
            cnt++,c++;
        }
        if((n-cnt)%2==0)printf("%d",cnt);
        if((n-cnt)%2!=0)printf("%d",cnt);
    }
    if(n%2!=0){
        int cnt=0;
        k=(n+1)%2,b=(n+1)%2-1,c=(n+1)%2+1;
        while(a[k]==a[b]&&b>=1){
            cnt++,b--;
        }
        while(a[k]=a[c]&&c<=n){
            cnt++,c++;
        }
        if((n-cnt)%2==0)printf("%d",cnt);
        if((n-cnt)%2!=0)printf("%d",cnt);
    }
    return 0;
}

